//414.第三大的数
//https://leetcode.cn/problems/third-maximum-number/
class Solution {
public:
    int thirdMax(vector<int>& nums) {
        set<int> s(nums.begin(),nums.end());
        if(s.size() < 3) return *(--s.end());
        set<int>::iterator it = s.end();
        for(int i = 0;i<3;++i,--it);
        return *it;
    }
};
